#include "ReadFile.h"
#include <fstream>
#include <iostream>
#include <string>
using namespace std;

int main() 
{
	string path = R"(C:\Users\Administrator\Desktop\C++.txt)";
	ifstream 	infile(path);
	
	//infile.open(R"("C:\Users\Administrator\Desktop\C++.txt")");

	if (!infile.is_open()) {
		std::cerr << "无法打开文件！" << std::endl;
		return 1;
	}
	string content;
	//istream line = getline(infile, content);
	while (getline(infile, content))
	{
		cout << content << endl;
	}

	infile.clear();
	// 将文件指针重置到开头
	infile.seekg(0);
	for (std::string line; std::getline(infile, line); ) {
		std::cout << "读取到: " << line << std::endl;
	}


	infile.close();
	return 0;
}